{%extends 'template.html'%}

{%block content%}
<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">{{head.value}}</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="btn-group">
                        <a><button id='bt-add' type="button" class="btn btn-primary">增加</button></a>
                        <a><button id='bt-del' data-text="确定删除资源池? 0个" type="button" class="btn btn-danger">删除</button></a>
                    </div>
                    <div class="pull-right">
                      <div class="btn-group">
                        <a><button id='bt-upload' type="button" class="btn btn-primary" >导入</button></a>
                        <a href="/assets/export_devices"><button id='bt-export' type="button" class="btn btn-primary" >导出</button></a>
                      </div>
                    </div>
                </div>
                <div class="panel-body">
                  <div id="div-upload" class="hide">
                    <form id="submit-file-form" enctype="multipart/form-data" action="/assets/upload_excel_ip_pool/" method="post">
                      <div class="form-group">
                        {{form}}
                      <p class="help-block">上传到资源池</p>
                      <a href="/assets/template_ip_pool/">下载模板样式</a>
                      <br>
                      <br>
                      <button type="submit" class="btn btn-primary" name='action'>上传</button>
                      </div>
                  </div>
                    </form>
                </div>
                  <table id="mytable" class="display" width="100%" cellspacing="0">
                      <thead>
                          <tr>
                              <th class="center sorting_disabled">
                                <label class="pos-rel">
                                  <input id='chb-all' type="checkbox"/>
                                </label>
                              </th>
                              <th>IP段序号</th>
                              <th>起始ip</th>
                              <th>结束ip</th>
                              <th>网关</th>
                              <th>子网掩码</th>
                              <th>vlan</th>
                              <th>ip类型</th>
                              <th>IP段状态</th>
                              <th>属性</th>
                              <th>所属平台</th>
                              <th>操作</th>
                          </tr>
                      </thead>
                  </table>
                </div>
            </div>
        </div>
        <!-- Modal -->
        <div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel"></h4>
              </div>
              <div class="modal-body">
                <div class="alert alert-danger alert-dismissable" id='modal-notify'>
                  <button type="button" class="close" id="bt-modal-notify">&times;</button>
                  <label id='lb-msg'></label>
                </div>
                <form class="form-horizontal" role="form">
                  <div class="form-group" id="show_ip_segment">
                      <label class="col-sm-3 control-label ">IP段序号</label>
                        <div class="col-sm-8">
                          <input type="text" class="form-control " id="ip_segment">
                        </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">起始ip</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control "  placeholder="10.2.1.1" id="start_ip">
                      </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">结束ip</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control " placeholder="10.2.1.253" id="en_ip">
                      </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">网关</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control " placeholder="10.2.1.254" id="gateway">
                      </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">掩码</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control " placeholder="255.255.0.0" id="netmask">
                      </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">vlan</label>
                      <div class="col-sm-8">
                        <input type="text" class="form-control " placeholder="1024" id="vlan">
                      </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">状态</label>
                        <div class="col-sm-8" id="show_belongs_to_iptype">
                          <select id="pool_status",style="width: 100%">
                            <option value="0">finish</option>
                            <option selected="selected" value="1">active</option>
                          </select>
                        </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">属性</label>
                        <div class="col-sm-8">
                          <select id="pool_type",style="width: 100%">
                            <option value="1">公有</option>
                            <option selected="selected" value="0">私有</option>
                          </select>
                        </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">ip类型</label>
                        <div class="col-sm-8" id="show_belongs_to_iptype">
                          <select id="belongs_to_iptype" style="width: 100%">
                            <option selected="selected" value="0">选择ip类型</option>
                          </select>
                        </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">ip类型2(可选)</label>
                        <div class="col-sm-8" id="show_belongs_to_iptype2">
                          <select id="belongs_to_iptype2" style="width: 100%">
                            <option selected="selected" value="0">选择ip类型</option>
                          </select>
                        </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">成对的资源池段</label>
                        <div class="col-sm-8" id="show_belongs_to_iptype">
                          <select id="in_pair_with" style="width: 80%">
                            <option selected="selected" value="0">选择成对的段</option>
                          </select>
                          <button id="reset" type="button" class="btn btn-outline btn-primary btn-sm btn-danger">重置</button>
                        </div>
                  </div>
                  <div class="form-group">
                      <label class="col-sm-3 control-label">平台(可选)</label>
                        <div class="col-sm-7" id="show_belongs_to_platform">
                          <select id="belongs_to_platform" style="width: 80%">
                            <option selected="selected" value="0">选择平台</option>
                          </select>
                          <button id="reset_platform" type="button" class="btn btn-outline btn-primary btn-sm btn-danger">重置</button>
                        </div>
                  </div>
                </form>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button id='bt-save' type="button" class="btn btn-primary">保存</button>
              </div>
            </div><!-- /.modal-content -->
          </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
        <div class="modal fade" id="Modal-file" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">导入/导出</h4>
              </div>
              <div class="modal-body">
                <div class="alert alert-dismissable" id='upload-notify'>
                    <button type="button" class="close" id="bt-upload-notify">&times;</button>
                    <label id='lb-msg-upload'></label>
                </div>
                <form id="submit-file-form" enctype="multipart/form-data" action="/assets/upload_excel_ip_pool/" method="post">
                  <!-- {% csrf_token %} -->
                <div class="form-group">
                  {{form}}
                  <p class="help-block">上传到资源池</p>
                  <a href="/assets/template_ip_pool/">下载模板样式</a>
                </div>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="submit" class="btn btn-primary" name='action'>保存</button>
              </div>
              </form>
            </div><!-- /.modal-content -->
          </div><!-- /.modal-dialog -->
        </div>
    </div>
</div>
{%endblock%}
{%block bodyjs%}
    <script src="/static/js/jquery.dataTables.js" ></script>
    {{ django_context_varable }}
    {% verbatim %}
    <script id="tpl" type="text/x-handlebars-template">
          {{#each func}}
          <button type="button" class="btn btn-{{this.type}} btn-sm" onclick="{{this.fn}}">{{this.name}}</button>
          {{/each}}
    </script>
    {% endverbatim %}
    <script src="/static/js/handlebars-v3.0.1.js"></script>
    <script src="/static/js/ip_pool.js"></script>
    <script src="/static/js/dataTables.colVis.js"></script>
    <script type="text/javascript" src="/static/js/zebra_datepicker.js"></script>
{%endblock%}
{%block css%}
<link href="/static/css/jquery.dataTables.css" rel="stylesheet" type="text/css">
<link href="/static/css/mycss.css" rel="stylesheet" type="text/css">
<link href="/static/css/dataTables.colVis.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/static/css/datetimepicker.css">
{%endblock%}
